<template>
	<view class="in-anm" style=" margin: 30rpx auto; width: 90%;">
		<tg-slide @changeChoice="changeTip" :tipList="tipList" style="width: 600rpx; margin: 20rpx auto;"></tg-slide>
		<view v-if="!isaudit" class="body">
			<list-item v-for="(item,index) in unAuditList" :level="2" :item="item" schema="reviewed"></list-item>
		</view>
		<view v-else class="body">
			<list-item v-for="(item,index) in auditList" :level="3" :item="item" schema="reviewed"></list-item>
		</view>
		<view style="text-align: center; color: #808080; margin: 15rpx auto;">
			没有更多啦...
		</view>
	</view>
</template>

<script>
	import butt from '../../../components/ui/myButt.vue'
	import tipList from '../../../components/ui/tg-tip-list.vue'
	import listItem from '@/components/ui/page/emigration-list-item.vue'
	import tgSlide from "@/components/ui/tg-slide.vue"
	export default {
		components: {
			butt,
			tipList,
			listItem,
			tgSlide
		},
		async onReachBottom() {
			var that = this
			if(isaudit){
				this.unAuditPage++;
				//获取未审核列表下一页内容
				var unlist = await this.getUnAuditList({
					page:this.unAuditPage,
					size:10
				}) 
				
				unlist.forEach(e=>{
					that.unAuditList.push(e)
				})
				
			}else{
				this.auditPage++;
				//获取已审核列表下一页内容
				var list = await this.getAuditList({
					page:this.auditPage,
					size:10
				}) 
				
				list.forEach(e=>{
					that.auditList.push(e)
				})
			}
		},
		data() {
			var that = this
			return {
				tipList: [{
						content: '未审核',
						color: '#63C3FF',
					},
					{
						content: '已审核',
						color: '#63C3FF'
					},
				],
				title: '按名字',
				tips: [{
					title: '按名字',
					tap: function() {
						return this.zoom
					}.bind(that)
				}, {
					title: '按时间',
					tap: function() {
						return this.zoom
					}.bind(that)
				}],
				isTap1: false,
				list: [],
				unAuditPage: 1,
				auditPage: 1,
				auditList: [],
				unAuditList: [],
				isaudit: false,
			}
		},
		async onShow() {
			var that = this
			//已审核和未审核页面，列表重置
			that.unAuditPage = 0
			that.auditPage = 0
			that.unAuditList = []
			that.auditList = []

			//获取未审核列表 第一页内容
			that.unAuditList = await this.getUnAuditList({
				page:1,
				size:10
			}) 
			
			//获取已审核列表 第一页内容
			var data = await this.getAuditList({
				page:1,
				size:10
			})
			this.auditList = data
		},
		methods: {
			async getAuditList(page){ 
				var data = await this.$api.showHandleDeal(page);
				console.log(data)
				return data
			},
			async getUnAuditList(page) {
				var data = await this.$api.showWaitDeal(page);
				console.log(data)
				return data
			},
			changeTip(e) {
				console.log(e)
				
				this.isaudit = e.current == 0 ? false:true
			},
			tap1() {
				this.isTap1 = true
			},
			changeTap(e) {
				this.isTap1 = false
				console.log(e)
				this.title = this.tips[e.index].title
			},
			clickButt(e) {
				this.$utiltg.console("12312313")
				this.$refs.tip.show()
				console.log(e)
			}
		}
	}
</script>

<style scoped>
	.body::before {
		content: "";
		width: 100%;
		display: block;
		height: 50rpx;
	}
</style>






<!-- 

<template>
	<view>
		<emigration-list-item v-for="(item,index) in itemList" :level="2" :key="index" :item="item"></emigration-list-item>

	</view>
</template>

<script>
	import EmigrationListItem from '@/components/ui/page/emigration-list-item.vue'
	export default {
		components: {
			EmigrationListItem
		},
		data() {
			return {
				itemList: [],
				page: 1
			}
		},
		async onShow() {
			var res = await this.$api.immigrationList();
			this.itemList = res.data.result
			this.itemList.forEach(e => {
				e.procData = JSON.parse(e.procData)
			})
			console.log(this.itemList)
		},
		async onReachBottom() {
			this.page++
			var res = await this.$api.immigrationList({
				page: this.page,
				size: 10
			});
			var itemList = res.data.result
			itemList.forEach(e => {
				e.procData = JSON.parse(e.procData)
				this.itemList.push(e)
			})
			console.log(this.itemList)
		},
		methods: {

		}
	}
</script>

<style>
	.choice::before {
		content: "";
		display: block;
		flex: 0.8;
		height: 1rpx;
	}
</style>
 -->